from Inspect.models import Users
from flask import jsonify


class userController:
    def login(**kwargs):

        obj = Users.query.filter_by(phone=kwargs['phone'], password=kwargs['password']).first()
        if obj:
            if obj.to_json()['password'] == kwargs['password']:
                return {
                    "code": "200",
                    "data": obj.to_json()
                }
        else:
            return {
                "code": "201",
                "msg": "账号密码错误"
            }
